<template>
  <div v-loading="loading">
    <p class="title" v-if="$route.params.faqSecondType">{{$route.params.faqSecondType}}</p> 
    <p class="title" v-else>{{$route.params.faqtype}}</p> 

    <div  > 
      <el-collapse v-model="activeName" accordion  v-for="item in list" :key="item.id" >
          <el-collapse-item >
            <template slot="title">{{item.questions}}</template>
            <p v-html="item.answers"></p>
        </el-collapse-item>
      </el-collapse>
    </div>
 
 
   
  </div>
</template>

<script>
import {list} from "@/api/faq"
import { mapGetters } from 'vuex'
export default {
  data () {
    return {
      activeName: '121',
      list: [],
      loading: false,
      style: ''
    }
  },
  watch:{
    $route :function() {
      this.getList()
    },
    curSite: function(){
      if(this.curSite.id){
        this.getList()

      }
    }
  },
  mounted () {
    if(this.curSite.id){
      this.getList()

    }
  },
    computed: {
  ...mapGetters(['curSite']),
  },
  methods: {
    getList() {
      this.loading = true
      let params = {
        site_id: this.curSite.id,
        faq_type: this.$route.params.faqtype,
        faq_second_type: this.$route.params.faqSecondType,
        
      }
      list(params).then(res=>{
        let data = res.data
        this.list = data
        this.loading = false
      })
    },
  }
}
</script>

<style lang="scss">

</style>